-
Notifications
You must be signed in to change notification settings - Fork 17k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tools: Enable Unit Testing for SITL #18404
Conversation
b41dbe7
to
7f7a254
Compare
a3da5c8
to
7a8f183
Compare
I switched this to use |
7a8f183
to
76dab3a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Reduce a bit the coverage stats but it will allow to cover the missing functions, so that is great!
I think that having the weak symbol on panic for SITL and Linux is fine
it doesn't impact Chibios builds according to tests
@khancyr Could you explain to me how it reduces the coverage stats? I'm learning about coverage in general so I'm interested to figure this out. |
As we are now using SITL on coverage, we are passing over lines that were restricted to SITL only before. Those are mostly some panic and debug lines. But we don't necessary check them as there weren't there on Linus build. Therefore we test more stuff but check less outputs so our coverage statistic is dropping. You can see it easily on the coverage report |
Ahh makes sense. So you are telling me I need to add some more tests to get your coverage stats back up ;) I ran the coverage report for the only test that is SITL only SIM_MS5611. They were quite useful to find that one of my tests in that wasn't testing a few lines they were supposed to be. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me.
My understanding is this would've helped with some testing that was being done as part of some sim refactoring.
@khancyr what do you think?
I have tested and it is working. So that is fine with me. |
This enables units tests to be run by CI when built under SITL. The reasoning for this came from PR #18365 & #18363 where I was trying to fix simulated drivers and spent far to long in the debugger when a unit test would have worked perfectly.
It enables GTest to catch exit events such as an abort.
Thus we can test that SITL creates Internal_Errors where required and prevent regressions as a bonus.
There are some details, such as the method to detect if the unit tests or running inside the
Panic()
, that I'm not sure will work across all platforms?Log from the "test unit tests ...." tab in this PR showing the
![image](https://user-images.githubusercontent.com/69225461/130198335-5069c3cf-3443-4b4e-9e9b-604423f3c9d1.png)
Panic: AP_Internal_Error
being printed and caught by GTest for evaluation.